package com.itfreer.utils;

import android.graphics.Color;

/**
 * 颜色操作
 */
public class ColorUtils
{
    /**
     * 16进制转10进制
     * @param color
     * @return
     */
    public static int Hex2Int(String color)
    {
        return Color.parseColor(color);
    }

    /**
     * 16进制转rgb
     * @param color
     * @return
     */
    public static int[] Hex2Rgb(String color)
    {
        Integer colori = Hex2Int(color);
        int[] colorarray = new int[3];
        colorarray[0]= (colori & 0xff0000) >> 16;
        colorarray[1] = (colori & 0x00ff00) >> 8;
        colorarray[2] = (colori & 0x0000ff);
        return colorarray;
    }
}
